package com.kamistoat.meimeimall.meimeimallseckill.web;

import com.kamistoat.meimeimall.common.To.seckillTo.SecKillSessionTo;
import com.kamistoat.meimeimall.common.annotation.DubboAndHTTPExceptionCatch;
import com.kamistoat.meimeimall.common.utils.R;
import com.kamistoat.meimeimall.meimeimallseckill.service.SeckillSessionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "秒杀活动总页操作")
@RestController
@RequestMapping("web")
public class SecKillPageController {

    @Autowired
    SeckillSessionService seckillSessionService;

    @ApiOperation("带缓查询未来三天内的所有秒杀活动")
    @GetMapping("/get_three_day_seckill")
    @DubboAndHTTPExceptionCatch
    public R getThreeDaySecKill() {
        List<SecKillSessionTo> futureSecKillSessionList = seckillSessionService.getFutureSecKillSessionList();
        return R.ok().put("futureSecKillSessionList", futureSecKillSessionList);
    }
}
